<?php

/*
=====================================================
 FluxBB - Delux Board Converstations (DBC)
-----------------------------------------------------
 http://dbc-forum.com/
 http://fluxbb.org/
-----------------------------------------------------
 Copyright (c) 2010,2011 FluxBB - Delux Board Conversations (DBC)
-----------------------------------------------------
 Предсловие: Данный скрипт (DBC) не является работой с нуля, то 
 есть ядром скрипта всё также остаётся FuxBB,но теперь в оболочке
 DBC.
=====================================================
*/

if (!defined('DBC'))
	exit;
if (isset($_GET['ajax']))
{
	$db->end_transaction();
	$db->close();
	return;
}

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{content}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
require DBC_ROOT.'engine/uploadf.php';

?>
<?php
if ($footer_style == 'viewforum' || $footer_style == 'viewtopic')
{
	echo "\t\t\t".'<div align="left" border="0" class="conl br_conl"><div style="padding: 4px;">'."\n";

	// Display the "Jump to" drop list
	if ($DBC_config['o_quickjump'] == '1')
	{
		// Load cached quick jump
		if (file_exists(FORUM_CACHE_DIR.'cache_quickjump_'.$DBC_user['g_id'].'.php'))
			include FORUM_CACHE_DIR.'cache_quickjump_'.$DBC_user['g_id'].'.php';

		if (!defined('DBC_QJ_LOADED'))
		{
			if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
				require DBC_ROOT.'engine/cache.php';

			generate_quickjump_cache($DBC_user['g_id']);
			require FORUM_CACHE_DIR.'cache_quickjump_'.$DBC_user['g_id'].'.php';
		}
	}
	echo (!empty($lang_temp)) ? $lang_temp : ''; 
	echo "\t\t\t".'</div></div>'."\n";
}
?>

<div id="brdfooter" class="block">
	<div class="box">
<?php

if (isset($footer_style) && ($footer_style == 'viewforum' || $footer_style == 'viewtopic') && $is_admmod)
{
	echo "\t\t".'<div id="modcontrols" class="inbox">'."\n";

	if ($footer_style == 'viewforum')
	{
		echo "\t\t\t".'<table height="30" width="100%" class="botmenu_table" border="0" cellpadding="0" cellspacing="0"><tr>
<td align="left" width="12" class="botmenu_left"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
<td align="center" width="100%" style="float: center;" height="30" class="botmenu_center"><center>
<ul class="bottmenu" align="center">'."\n";
		echo "\t\t\t\t".'<dt><strong>'.$lang_forum['Mod controls'].'</strong></dt>'."\n";
		echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;p='.$p.'">'.$lang_common['Moderate forum'].'</a></span></li>'."\n";
		echo "\t\t\t".'<li id="navlogin"><a href="#" class="last_item"></a></li></ul></center></td>
<td align="right" width="12" class="botmenu_right"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
</tr></table>'."\n";
	}
	else if ($footer_style == 'viewtopic')
	{
		echo "\t\t\t".'<table height="30" width="100%" class="botmenu_table" border="0" cellpadding="0" cellspacing="0"><tr>
<td align="left" width="12" class="botmenu_left"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
<td align="center" width="100%" style="float: center;" height="30" class="botmenu_center"><center>
<ul class="bottmenu" align="center">'."\n";
		echo "\t\t\t\t".'<dt><strong>'.$lang_topic['Mod controls'].'</strong></dt>'."\n";
		echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;tid='.$id.'&amp;p='.$p.'">'.$lang_common['Moderate topic'].'</a> <a href="moderate.php?fid='.$forum_id.'&amp;tid='.$id.'&amp;action=all">All</a></span></li>'."\n";
		echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;move_topics='.$id.'">'.$lang_common['Move topic'].'</a></span></li>'."\n";

		$vcsrf_hash = csrf_hash();
		if ($cur_topic['closed'] == '1')
			echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;open='.$id.'&amp;csrf_hash='.$vcsrf_hash.'">'.$lang_common['Open topic'].'</a></span></li>'."\n";
		else
			echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;close='.$id.'&amp;csrf_hash='.$vcsrf_hash.'">'.$lang_common['Close topic'].'</a></span></li>'."\n";

		if ($cur_topic['sticky'] == '1')
			echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;unstick='.$id.'&amp;csrf_hash='.$vcsrf_hash.'">'.$lang_common['Unstick topic'].'</a></span></li>'."\n";
		else
			echo "\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/moderate.php?fid='.$forum_id.'&amp;stick='.$id.'&amp;csrf_hash='.$vcsrf_hash.'">'.$lang_common['Stick topic'].'</a></span></li>'."\n";

		echo "\t\t\t".'<li id="navlogin"><a href="#" class="last_item"></a></li></ul></center></td>
<td align="right" height="30" class="botmenu_center"><input class="bbcodes" style="margin-right: 5px;" value="?" onclick="board_info();" type="button" /></td>
<td align="right" width="12" class="botmenu_right"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
</tr></table>'."\n";
	}

	echo "\t\t\t".'<div class="clearer"></div>'."\n\t\t".'</div>'."\n";
}

?>
		<div id="brdfooternav" class="inbox">
<?php

// If no footer style has been specified, we use the default (only copyright/debug info)
$footer_style = isset($footer_style) ? $footer_style : NULL;

if ($footer_style == 'index' || $footer_style == 'blog' || $footer_style == 'Registered' || $footer_style == 'search')
{
//	echo "\t\t\t".'<div class="conl">'."\n";

	if (!$DBC_user['is_guest'] && $DBC_user['g_search'] == '1')
	{

	echo "\t\t\t".'<div align="center" class="inbox">'."\n";
		echo "\t\t\t\t".'<center><table height="30" width="100%" class="botmenu_table" border="0" cellpadding="0" cellspacing="0"><tr>
<td align="left" width="12" class="botmenu_left"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
<td align="center" width="100%" style="float: center;" height="30" class="botmenu_center"><center>
<ul class="bottmenu" align="center">'."\n";

		echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/active_topics">'.$lang_common['Show recent posts'].'</a></span></li>'."\n";
		echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/unanswered">'.$lang_common['Show unanswered posts'].'</a></span></li>'."\n";

		if ($DBC_config['o_subscriptions'] == '1')
			echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/subscriptions">'.$lang_common['Show subscriptions'].'</a></span></li>'."\n";

		echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/posts_uid'.$DBC_user['id'].'">'.$lang_common['Show your posts'].'</a></span></li>'."\n";

		echo "\t\t\t\t".'<li id="navlogin"><a href="#" class="last_item"></a></li></ul></center></td>
<td align="right" height="30" class="botmenu_center"><input class="bbcodes" style="margin-right: 5px;" value="?" onclick="board_info();" type="button" /></td>
<td align="right" width="12" class="botmenu_right"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
</tr></table></center>'."\n";
	echo "\t\t\t".'<div class="clearer"></div>'."\n\t\t\t".'</div>'."\n";
	}
	else
	{
		if ($DBC_user['g_search'] == '1')
		{
	echo "\t\t\t".'<div id="modcontrols" class="inbox">'."\n";
			echo "\t\t\t\t".'<center><table height="30" width="100%" class="botmenu_table" border="0" cellpadding="0" cellspacing="0"><tr>
<td align="left" width="12" class="botmenu_left"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
<td width="100%" height="30" class="botmenu_center"><ul class="bottmenu">'."\n";

			echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/active_topics">'.$lang_common['Show recent posts'].'</a></span></li>'."\n";
			echo "\t\t\t\t\t".'<li><span><a href="'.$DBC_config['o_base_url'].'/unanswered">'.$lang_common['Show unanswered posts'].'</a></span></li>'."\n";

			echo "\t\t\t\t".'<li id="navlogin"><a href="#" class="last_item"></a></li></ul></td>
<td align="right" height="30" class="botmenu_center"><input class="bbcodes" style="margin-right: 5px;" value="?" onclick="board_info();" type="button" /></td>
<td align="right" width="12" class="botmenu_right"><img src="'.$DBC_config['o_base_url'].'/engine/skins/images/spacer.gif" border="0" alt="" /></td>
</tr></table></center>'."\n";
	echo "\t\t\t".'<div class="clearer"></div>'."\n\t\t\t".'</div>'."\n";
		}
	}
}
else if (!empty($lang_temp))
{
	echo "\t\t\t".'<div class="conl">'."\n";
	echo $lang_temp;
	echo "\t\t\t".'</div>'."\n";
}

?>
			<div class="clearer"></div>
		</div>
	</div>
</div>
<script src="engine/classes/js/jquery-jLinkPreview-1.0.0-min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
   $().jLinkPreview({
         'preload': false,
         'width': 256,
         'height': 192,
         'fade': 300,
         'background-color': '#333',
         'elementsHavingId': '',
         'elementsHavingClass': 'example',
   });
});
</script>
<script type="text/javascript"> 
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18245222-1']);
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
 
</script>
<script type="text/javascript" src="<?php echo $DBC_config['o_base_url'] ?>/engine/classes/js/iLoad.js"></script>
<?php

// End the transaction
$db->end_transaction();

// Display executed queries (if enabled)
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{footer}', $tpl_temp, $tpl_main);
ob_end_clean();

// Display debug info (if enabled/defined)
ob_start();
if (defined('DBC_DEBUG'))
{
	echo '<p id="debugtime">[ ';

	// Calculate script generation time
	$time_diff = sprintf('%.3f', get_microtime() - $DBC_start);
	echo sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries());

	if (function_exists('memory_get_usage'))
	{
		echo ' - '.sprintf($lang_common['Memory usage'], file_size(memory_get_usage()));

		if (function_exists('memory_get_peak_usage'))
			echo ' '.sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage()));
	}

	echo ' ]</p>'."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{time}', $tpl_temp, $tpl_main);
ob_end_clean();


ob_start();
if (defined('DBC_DEBUG'))
{
	echo '<span id="copyright">'.$lang_common['copy'].' '.$DBC_config['o_cur_version'].'</span>'."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{copy}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['DBC_title'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{DBC_title}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
?>
<script type="text/javascript" src="<?php echo $DBC_config['o_base_url'] ?>/engine/classes/js/clock.js"></script>
<span class="clock24s" id="clock24_58471" style="color:#ffffff;font-size: 11px;" title="">Forum time</span>
<script type="text/javascript">
var clock24_58471 = new clock24('58471',180,'%W, %dd %M %yyyy %hh:%nn:%ss','ru');
clock24_58471.daylight('RU'); clock24_58471.refresh();
</script>
<?php
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{date_time}', $tpl_temp, $tpl_main);
ob_end_clean();






ob_start();
if (defined('DBC_DEBUG'))
{
	echo '<span class="DBC_Welcome">'.$lang_common['DBC_Welcome'].'</span>'."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{DBC_Welcome}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['DBC_info'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{DBC_info}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['last_themes'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{last_themes}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['adv'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{adv}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['info_p'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{info_p}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();

?>

<?php
if ($DBC_config['o_coding_forms'] == '1')
{
?><script type="text/javascript">document.write(base64decode('<?php echo base64_encode('<input type="checkbox" name="not_robot_num" value="1" tabindex="4" />'); ?>'));</script><?php
} else { 
?><input type="checkbox" class="input_check" name="not_robot_num" value="1" tabindex="4" />
<?php
}
echo $lang_login['Not robot'] ?>
<?php
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{no_robot}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
	echo ''.$lang_common['close'].''."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{close}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();
if (defined('DBC_DEBUG'))
{
if ($footer_style == 'index')
{
	if ($DBC_config['o_feed_type'] == '1')
		echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;type=rss" class="links">'.$lang_common['RSS active topics feed'].'</a></span></p>'."\n";
	else if ($DBC_config['o_feed_type'] == '2')
		echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;type=atom" class="links">'.$lang_common['Atom active topics feed'].'</a></span></p>'."\n";
}
else if ($footer_style == 'viewforum')
{
	if ($DBC_config['o_feed_type'] == '1')
		echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;fid='.$forum_id.'&amp;type=rss" class="links">'.$lang_common['RSS forum feed'].'</a></span></p>'."\n";
	else if ($DBC_config['o_feed_type'] == '2')
		echo "\t\t\t\t".'<p id="feedlinks" class="actions"><span class="atom"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;fid='.$forum_id.'&amp;type=atom" class="links">'.$lang_common['Atom forum feed'].'</a></span></p>'."\n";
}
else if ($footer_style == 'viewtopic')
{
	if ($DBC_config['o_feed_type'] == '1')
		echo "\t\t\t\t".'<p id="feedlinks"><span class="rss"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;tid='.$id.'&amp;type=rss" class="links">'.$lang_common['RSS topic feed'].'</a></span></p>'."\n";
	else if ($DBC_config['o_feed_type'] == '2')
		echo "\t\t\t\t".'<p id="feedlinks"><span class="atom"><a href="'.$DBC_config['o_base_url'].'/extern.php?action=feed&amp;tid='.$id.'&amp;type=atom" class="links">'.$lang_common['Atom topic feed'].'</a></span></p>'."\n";
}

}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{rss}', $tpl_temp, $tpl_main);
ob_end_clean();

ob_start();

require DBC_ROOT.'language/languages.php';
$lang_temp = '';
if (isset($languages) && count($languages) > 1)
{
	$lang_temp .= "\t\t\t\t".'<div style="padding-left: 10px;"><form id="qjump" action="misc.php" method="get">'."\n\t\t\t\t\t".'<div><label>'."\n\t\t\t\t\t\t".'<input type="hidden" name="action" value="lang" />'."\n\t\t\t\t\t\t".'<select name="lang" onchange="this.form.submit()">'."\n";
	foreach ($languages as $temp)
	{
		if ($DBC_user['language'] == $temp)
			$lang_temp .= "\t\t\t\t\t\t\t".'<div style="padding-left: 10px;"><option value="'.$temp.'" selected="selected">'.$temp.'</option></div>'."\n";
		else
			$lang_temp .= "\t\t\t\t\t\t\t".'<div style="padding-left: 10px;"><option value="'.$temp.'">'.$temp.'</option></div>'."\n";
	}
	$lang_temp .= "\t\t\t\t\t\t".'</select>'."\n\t\t\t\t\t".'</label></div>'."\n\t\t\t\t".'</form></div>'."\n";
}


if (defined('DBC_DEBUG'))
{
	echo "\t\t\t".'<div class="conl" style="padding-left: 10px;">'."\n";
	echo (!empty($lang_temp)) ? $lang_temp : ''; 
	echo "\t\t\t".'</div>'."\n";
}
if (defined('DBC_SHOW_QUERIES'))
	display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('{language}', $tpl_temp, $tpl_main);
ob_end_clean();

// Close the db connection (and free up any result data)
$db->close();


// Spit out the page
exit($tpl_main);